<?php

function getUid()
{
    return \think\Session::get('sid');
}

function is_administrator($user_id)
{
    $group_id = get_group_id($user_id);

    if (empty($group_id)) return false;

    if ($group_id == c('admin_group_id')) return true;

    return false;
}

function get_group_id($user_id)
{
    $group_id = db('auth_group_access')->where(['user_id' => $user_id])->value('group_id');

    if (empty($group_id)) return false;
    else return $group_id;
}